using Headspring.Training.Core.Services;

namespace Headspring.Training.Core.Model.StateCommands
{
	public class CompleteToAssignedCommand : StateCommandBase
	{
		public CompleteToAssignedCommand(WorkOrder workOrder, Employee currentUser)
			: base(workOrder, currentUser)
		{
		}

		public override string TransitionVerbPresentTense
		{
			get { return "Re-Assign"; }
		}

		public override string TransitionVerbPastTense
		{
			get { return "Re-Assigned"; }
		}

		public override WorkOrderStatus GetBeginStatus()
		{
			return WorkOrderStatus.Complete;
		}

		protected override WorkOrderStatus GetEndStatus()
		{
			return WorkOrderStatus.Assigned;
		}

		protected override bool userCanExecute(Employee currentUser)
		{
			return currentUser == _workOrder.Creator;
		}

		protected override void postExecute(IStateCommandVisitor commandVisitor)
		{
			commandVisitor.EditWorkOrder(_workOrder);
		}
	}
}